#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <aclconio.h>
#include <define.h>
#include <transact.h>
#include <tran.h>
#include <gds.h>
#include <sizes.h>
#include <\SOFTPAY\Ver30\source\include\sizes.h>
#include <\SOFTPAY\Ver30\HostSrc\citisrc\citiids.h>
#include <\SOFTPAY\Ver30\HostSrc\cpacsrc\cpacids.h>
#include <confio.h>

#include <\SOFTPAY\Ver30\source\include\DCT.h>

const char*DCTName = "DCT.dat";

static DCT_REC srDCTRec;

static int recordNum;
int	inLoadDCTRec (int inRecNumber)
{
	int inRet;

	inRet = inLoadConfRec(DCT_FILENAME, SIZE_DCT_REC, inRecNumber, (char *) &srDCTRec);

	recordNum = inRecNumber;
	return inRet;
}

void *pvdGetDCTRec(void)
{
	return &srDCTRec;

}

int	inSaveDCTRec (int inRecNumber)
{
	int inRet;

	inRet = inSaveConfRec(DCT_FILENAME, SIZE_DCT_REC, inRecNumber, (char *) &srDCTRec);

	return inRet;
}

int	inGetDCTRecNumber (void)
{
	return recordNum;
}

int	inUpdateDCTRec (void)
{
	int inRet;

	inRet = inSaveConfRec(DCT_FILENAME, SIZE_DCT_REC, recordNum, (char *) &srDCTRec);

	return inRet;
}

void	vdResetDCTRec (void)
{
	memset((void*)&srDCTRec, 0, REC_SIZEOF(srDCTRec));
}

char* szGetPINKey(void)
{
	return srDCTRec.szPINKey;
}

void vdSetPINKey(const char* szPINKey)
{
	strNumCopy(srDCTRec.szPINKey, szPINKey, sizeof(((DCT_REC*)NULL)->szPINKey)-1);
}

short inGetMinPINDigit(void)
{
	return srDCTRec.inMinPINDigit;
}

void vdSetMinPINDigit(short inMinPINDigit)
{
	srDCTRec.inMinPINDigit = inMinPINDigit;
}

short inGetMaxPINDigit(void)
{
	return srDCTRec.inMaxPINDigit;
}

void vdSetMaxPINDigit(short inMaxPINDigit)
{
	srDCTRec.inMaxPINDigit = inMaxPINDigit;
}

char chGetMasterKeyAddress(void)
{
	return srDCTRec.chMasterKeyAddress;
}

void vdSetMasterKeyAddress(char chMasterKeyAddress)
{
	srDCTRec.chMasterKeyAddress = chMasterKeyAddress;
}

char* szGetKSI(void)
{
	return srDCTRec.szKSI;
}

void vdSetKSI(const char* szKSI)
{
	strNumCopy(srDCTRec.szKSI, szKSI, sizeof(((DCT_REC*)NULL)->szKSI)-1);
}

